#!/bin/bash

mv /etc/yum.repos.d/CentOS*  /etc/yum.repos.d/old/

mount /dev/sr0 /mnt/cdrom &> /dev/null

echo "/dev/sr0   /mnt/cdrom  iso9660	defaults	0 0" >> /etc/fstab

touch /etc/yum.repos.d/mnt_cdrom.repo

cat << eof > /etc/yum.repos.d/mnt_cdrom.repo
[centos7.9]
name=centos7.9
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
eof


yum clean all &> /dev/null

yum repolist all
